package com.welike.shibo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.welike.shibo.eneity.Comments;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by fangyu on 2019-08-18.
 */
public interface CommentsMapper extends BaseMapper<Comments> {

    // 查询视频的评论并分页
    IPage<Comments> selectCommentPage(Page<Comments> page, @Param("vid") String vid);

    List<Comments> selectAllComment(@Param("vid") String vid);

    // 查询视频最新的一条评论
    Comments selectCommentTop(@Param("vid") String vid);

//    Integer sumForLikeCountsById(@Param("id")String cid);
    // 通过id查询评论收获多少赞
    Integer queryLikeCountsById(@Param("id")Integer id);

    // 查询总共条数
    Integer countByComment();


    // 查询视频总共评论条数
    Integer countByVideoId(@Param("videoId")String videoId);

    IPage<Comments> queryAllByAuthorIdOrderByCreateTime(Page<Comments> page, @Param("authorId")String authorId);

    IPage<Comments> queryCommentsPage(Page<Comments> page);

    IPage<Comments> getCommentList();
}